<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
    <meta charset="utf-8" />
    <title>Python Worker Role Configuration</title>
    <style type="text/css">body { font-family: 'Segoe UI', Arial, Helvetica, sans-serif; font-weight: 200; font-size: 11pt; } p, h1, h2 { margin: 0; padding: 0; } h1 { font-size: 20pt; font-weight: bold; padding-top: 1em; } h1.top { padding-top: 0em; } h2 { font-size: 16pt; font-weight: 300; padding-top: 0.5em; padding-left: 0em; } p { padding-left: 0.5em; padding-bottom: 0.5em; } p.hint { color: #666666; } code { font-family: Consolas, 'Lucida Console', monospace; } ol { margin-top: 0; padding-top: 0; } ol > li { padding-top: 1.5em; } li > img { vertical-align: middle; }</style>
</head>
<body>
    <h1 class="top">Configuring Deployment</h1>

    <p>
        Some PowerShell scripts have been added to your project to configure and
        launch your worker. These may be edited freely to customize your
        deployment.
    </p>

    <p>
        To change the version of Python your worker should run with, set the
        <code>PYTHON</code> property in the <code>ServiceDefinition.csdef</code>
        file in your cloud project. See <code>ConfigureCloudService.ps1</code>
        for more details.
    </p>

    <p>
        To install packages using pip, update the <code>requirements.txt</code>
        file in the root directory of your project. The PowerShell script will
        install packages listed in it on deployment.
    </p>

    <p>
        To set <code>PYTHONPATH</code> (or equivalent) before running the
        worker, add the environment variable to your
        <code>ServiceDefinition.csdef</code>.
    </p>

    <p>
        To specify the script to run and any arguments, modify the command line
        in <code>ServiceDefinition.csdef</code>. The startup file and debug 
        options in your local project do not automatically transfer to the
        deployed service.
    </p>

    <h1>Troubleshooting Deployment</h1>

    <p>If your worker role does not behave correctly after deployment, check the following:</p>

    <ol>
        <li><p>Your Python project includes a bin\ folder with (at least):</p>
        <ul>
            <li><code>ConfigureCloudService.ps1</code></li>
            <li><code>LaunchWorker.ps1</code></li>
            <li><code>ps.cmd</code></li>
        </ul>
        </li>
        <li>Your Cloud project references those files from the service definition.</li>
        <li>Your Python project includes a <code>requirements.txt</code> file listing all dependencies.</li>
        <li>
            <p>Enable Remote Desktop on your Cloud Service and investigate the log files.</p>
            <p>
                Logs for <code>ConfigureCloudService.ps1</code> and
                <code>LaunchWorker.ps1</code> are stored in the following path
                on the machine instance:
            </p>
            <ul>
                <li><code>C:\Resources\Directory\%RoleId%.DiagnosticStore\LogFiles</code></li>
            </ul>
            <p>
                Currently, the <code>LaunchWorker.ps1</code> log is the only way
                to view output or errors displayed by your Python program.
            </p>
        </li>
        <li>
            Start a discussion at
            <a href="http://go.microsoft.com/fwlink/?LinkId=293415">our discussion forum</a>
            for further help.
        </li>
    </ol>
    
    <hr />
    <p class="hint">This readme file may be deleted when you no longer need it.</p>
</body>
</html>